package disanzuoye;

import java.util.Random;
import java.util.Scanner;

public class MagicNubser {
    public static void main(String[] args) {
        System.out.println("======欢迎来到猜拳游戏======");
        Random random = new Random();
        int guessnum = random.nextInt(2);
        int flag=0;
        while (true)
        {
            System.out.println("请输入你的选项，0-石头，1剪刀，2布");
            Scanner scanner = new Scanner(System.in);
            int usernum = scanner.nextInt();
            if (guessnum==usernum){
                System.out.println("平局");
            }else if (guessnum==0 && usernum==1){
                System.out.println("电脑出石头，你出剪刀，你输了");
            }else if (guessnum==0 && usernum==2){
                System.out.println("电脑出石头，你出布，你赢了");
            }else if (guessnum==1 && usernum==0){
                System.out.println("电脑出剪刀，你出石头，你赢了");
            }else if (guessnum==1 && usernum==2){
                System.out.println("电脑出剪刀，你出布，你输了");
            }else if (guessnum==2 && usernum==0){
                System.out.println("电脑出布，你出石头，你输了");
            }else if (guessnum==2 && usernum==1){
                System.out.println("电脑出布，你出剪刀，你赢了");
            }
            System.out.println("您还想继续玩吗？继续请输入：0，退出请输入：1");
            int a=scanner.nextInt();
            if (a==0){
                System.out.println("继续游戏");
            }else if (a==1){
                System.out.println("退出游戏");
                break;
            }
        }
    }
}
